//
//  XWHDoubleTitleCommonVC.swift
//  XiaoweHearingAid
//
//  Created by Riven on 2022/9/21.
//

import UIKit

class XWHDoubleTitleCommonVC: XWHBaseVC {
    
    override var largeTitleHeight: CGFloat {
        66
    }
    
    override var topContentInset: CGFloat {
        let tInset = super.topContentInset + 24
        
        return tInset
    }
    
    lazy var imageView = UIImageView()
    lazy var submitBtn = UIButton()

    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func setupNavigationItems() {
        super.setupNavigationItems()
        
        setNav(color: UIColor.white)
    }
    
    override func setLargeTitleMode() {
        isUseLargeTitleMode = true
        
        // 大标题方式1
        setLargeTitleModeFirst()
    }
    
    /// 设置带有LargeTitle的nav items
//    override func setNavigationBarWithLargeTitle() {
//        super.setNavigationBarWithLargeTitle()
//    }
    
    /// 还原没有LargeTitle的 nav itmes
//    override func resetNavigationBarWithoutLargeTitle() {
//        super.resetNavigationBarWithoutLargeTitle()
//    }
    
    override func addSubViews() {
        super.addSubViews()
        
        setLargeTitleMode()
        
        view.addSubview(imageView)
        view.addSubview(submitBtn)
        
        largeTitleView.button.isHidden = true
        largeTitleView.detailLb.isHidden = false
        
        largeTitleView.titleLb.textAlignment = .center
        largeTitleView.detailLb.textAlignment = .center
        
        largeTitleView.titleLb.text = titleText
        largeTitleView.detailLb.text = titleDetailText
        
        submitBtn.titleLabel?.font = AppFont.harmonyOSSans(ofSize: 21, weight: .medium)
        submitBtn.setTitleColor(UIColor.white, for: .normal)
        submitBtn.layer.cornerRadius = 27
        submitBtn.layer.backgroundColor = btnBgColor.cgColor
        submitBtn.addTarget(self, action: #selector(clickSubmitBtn), for: .touchUpInside)
    }
    
    override func relayoutLargeTitle() {
        relayoutLargeTitleFirst()
    }
    
    override func relayoutSubViews() {
        relayoutLargeTitle()
        relayoutLargeTitleForTitleDetail(leftRightInset: 16)
        relayoutSubmitBtn()
    }
    
    func relayoutSubmitBtn() {
        submitBtn.snp.makeConstraints { make in
            make.left.right.equalToSuperview().inset(64)
            make.height.equalTo(54)
            make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom).inset(44)
        }
    }
    
    @objc func clickSubmitBtn() {
        
    }

}
